<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrdersTable extends Migration
{
    /**
     * Run the migrations.
     * 商品订单表
     * @return void
     */
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('user_id')->comment('厂家ID');
            $table->string('user_name')->comment('厂家名称');
            $table->string('goods_name')->comment('商品名称');
            $table->string('goods_code')->comment('商品CODE');
            $table->decimal('goods_price',10,2)->comment('商品价格');
            $table->dateTime('order_time')->comment('下单时间');
            $table->string('shop_id')->comment('分销店ID');
            $table->string('shop_name')->comment('分销店名称');
            $table->string('courier_number')->nullable()->comment('快递单号');
            $table->string('order_id')->comment('订单号');
            $table->dateTime('pay_time')->nullable()->default(null)->comment('支付时间');
            $table->integer('pay_type')->default(1)->comment('支付状态,0订单失效,1等待支付,2支付完成');
            $table->integer('order_type')->default(0)->comment('订单状态,0未支付,1支付成功');
            $table->text('order_remarks')->nullable()->comment('订单备注');
            $table->softDeletes()->comment('软删除');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('orders');
    }
}
